package com.shoppingwebsite.domain;

/**
 *  TODO 基于ThreadLocal封装工具类，用户保存和获取当前登录用户的id
 */
public class BaseContext {
    private static ThreadLocal<Integer> threadLocal=new ThreadLocal<>();

    //保存id
    public static void setCurrentId(Integer id){
        threadLocal.set(id);
    }

    //获取id
    public static Integer getCurrentId(){
        return threadLocal.get();
    }
}

